require_once __DIR__ . '/../includes/PHPVersionCheck.php';
wfEntryPointCheck( 'cli' );
+use MediaWiki\Shell\Shell;
use Wikimedia\Rdbms\DBReplicationWaitError;
/**
* Do some sanity checking and basic setup
*/
public function setup() {
- global $IP, $wgCommandLineMode, $wgRequestTime;
+ global $IP, $wgCommandLineMode;
# Abort if called from a web server
# wfIsCLI() is not available yet
# But sometimes this doesn't seem to be the case.
ini_set( 'max_execution_time', 0 );
- $wgRequestTime = microtime( true );
-
# Define us as being in MediaWiki
define( 'MEDIAWIKI', true );
// something that can do the relevant syscalls. There are a few
// options. Linux and Mac OS X both have "stty size" which does the
// job directly.
- $retval = false;
- $size = wfShellExec( 'stty size', $retval );
- if ( $retval !== 0 ) {
+ $result = Shell::command( 'stty', 'size' )
+ ->execute();
+ if ( $result->getExitCode() !== 0 ) {
return $default;
}
- if ( !preg_match( '/^(\d+) (\d+)$/', $size, $m ) ) {
+ if ( !preg_match( '/^(\d+) (\d+)$/', $result->getStdout(), $m ) ) {
return $default;
}
return [ intval( $m[2] ), intval( $m[1] ) ];